#pragma once
#include "base/condition.h"
#include "base/function.hpp"
#include "base/mutex.h"
#include "base/noncopyable.h"
#include "base/config.h"

#include <queue>
#include <vector>
#include <string>

namespace net_tools::base{
class Thread;
class Threadpool : noncopyable{
 public:
  Threadpool(int pool_size = _C::WORK_THREAD_POOL_SIZE,int task_queue_max_size =  _C::WORK_THREAD_POOL_QUEUE_SIZE);
  ~Threadpool();
  void Addtask(func task);
 private:
  void Thread_todo();
  std::queue<func>     task_queue_;
  std::vector<Thread*> thread_vector_;
  size_t               thread_pool_size_;
  size_t               task_queue_max_size_;
  Mutex                mutex_;
  Condition            cond_;
};

} // namespace net_tools::base